<?php
//初始化容量为1024的table
$table  =new \Swoole\Table(1024);
$table->column('id',\Swoole\Table::TYPE_INT);
$table->column('name',\Swoole\Table::TYPE_STRING,10);
$table->column('score',\Swoole\Table::TYPE_FLOAT);
$table->create();

$table->set('student-1',['id'=>1,'name'=>'学院','score'=>80]);
$table->set('student-2',['id'=>2,'name'=>'学院','score'=>90]);
if($table->exist('student-1')){
    echo "Student-1".$table->get('student-1','id') ."：".$table->get('student-1','name');
}
// 自增操作
$table->incr('student-2', 'score', 5);
// 自减操作
$table->decr('student-2', 'score', 5);

// 表中总记录数
$count = $table->count();

// 删除指定表记录
$table->del('student-1');